import request from '@/utils/request';

export async function getProductQualityByPage (params: any) {
    return request('/api/quality/getProductQualityByPage', {
    method: 'POST',
    data: params,
  });
}

// 获取检验记录
export async function getProductQualityInspectionByPage (params: any) {
  return request('/api/quality/getProductQualityInspectionByPage', {
  method: 'POST',
  data: params,
});
}

export async function addProductQuality (params: any) {
    return request('/api/quality/addProductQuality', {
    method: 'POST',
    data: params,
  });
}

export async function updateProductQuality (params: any) {
    return request('/api/quality/updateProductQuality', {
    method: 'POST',
    data: params,
  });
}

export async function delProductQuality (params: any) {
    return request('/api/quality/delProductQuality', {
    method: 'POST',
    data: params,
  });
}

export async function exportProductQuality(params: any) {
    return request('/api/quality/exportProductQuality', {
    method: 'POST',
    data: params,
    responseType: 'blob',
  });
}

// 获取工单列表
export async function getWorkOrderInforList (params: any) {
  return request('/api/product/getWorkOrderInforList', {
  method: 'POST',
  data: params,
});
}

// 检验团队成员
export async function getQualityTeamMembers (params: any) {
  return request('/api/quality/getQualityTeamMembers', {
  method: 'POST',
  data: params,
});
}

// 检验标准
export async function getInspectionStandard (params: any) {
  return request('/api/quality/getInspectionStandard', {
  method: 'POST',
  data: params,
});
}

// 获取自检清单
export async function getInspectionTemplateByProductTypeAndType(para: any) {
  return request('/api/quality/getInspectionTemplateByProductTypeAndType', {
    method: 'POST',
    data: para,
    params: {
      productType: para.productType,
      type: para.type,
    },
  });
}

// 获取检验单信息（新）
export async function getProductQualityInspectionAllInfoByProductQualityId(para: any) {
  return request('/api/quality/getProductQualityInspectionAllInfoByProductQualityId', {
    method: 'POST',
    data: para,
    params: {
      productQualityId: para.productQualityId,
    },
  });
}

// 获取当前用户
export async function viewBaseInfo(params: any) {
  return request('/api/user/viewBaseInfo', {
    method: 'POST',
    data: params,
  });
}

//提交检验单
export async function submitInspectionTask(params: any) {
  return request('/api/quality/submitInspectionTask', {
    method: 'POST',
    data: params,
  });
}

//暂存检验单
export async function stagingInspectionTask(params: any) {
  return request('/api/quality/stagingInspectionTask', {
    method: 'POST',
    data: params,
  });
}
export default { getProductQualityByPage, addProductQuality, updateProductQuality, delProductQuality, exportProductQuality }
